package com.groot.medical.service;

import java.util.List;

import com.groot.medical.dao.PayDao;
import com.groot.medical.dao.PayDaoImpl;
import com.groot.medical.entity.PageBean;
import com.groot.medical.entity.Pay;

public class PayServiceImpl implements PayService {
	private PayDao payDao = new PayDaoImpl();
	@Override
	public PageBean findByPage(int pageNum, int pageSize, String currentYear, String townCode, String holdername) {
		int totalRecord = payDao.getAllPayCount(currentYear,townCode,holdername);
		PageBean pageBean = new PageBean<>(pageNum, pageSize, totalRecord);
		int startIndex = pageBean.getStartIndex();
		pageBean.setList(payDao.findFamilyByPage(startIndex,pageSize,currentYear,townCode,holdername));
		return pageBean;
		
	}
	@Override
	public List<Pay> findPayInfoByFamilyCodeAndYear(String familyCode, String nowTime) {
		List<Pay> pays = payDao.findPayInfoByFamilyCodeAndYear(familyCode,nowTime);
		return pays;
	}
	@Override
	public void payMoneyForPerson(List<Pay> payPerson) {
		payDao.payMoneyForPerson(payPerson);
		
	}
	@Override
	public List<Pay> findAllPayInfo() {
		List<Pay> payList = payDao.findAllPayInfo();
		return payList;
	}
	@Override
	public List<Pay> findPayInfoByCondition(String currentYear, String townCode, String holdername) {
		List<Pay> payList = payDao.findPayInfoByCondition(currentYear,townCode,holdername);
		return payList;
	}
	@Override
	public boolean findPersonInfoByIdAndYear(String idCardNum, String nowTime) {
		boolean flag = payDao.findPersonInfoByIdAndYear(idCardNum,nowTime);
		return flag;
	}
	@Override
	public int findIsExsitService(String familyCode) {
		// TODO Auto-generated method stub
		return payDao.findIsExsitService(familyCode);
	}
	@Override
	public int findIsExsitPayService(String idCardNum) {
		// TODO Auto-generated method stub
		return payDao.findIsExsitPayService(idCardNum);
	}

}
